<%--
 *  File:    ConditionEdit.jsp
 *  @Author: Hilldao
 *  Date:    2002/1/8
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  //init param
  Category cat = Category.getInstance("jsp.ConditionEdit");
  String strModuleName = "PCM";
  String privilegeCode = "Z0610,L205";
%>



<%
  HashMap userInfo = (HashMap)session.getAttribute("userinfo");

%>
<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="conditionedit"/>
<%@ include file="/inc/CatchError.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
</head>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script>
function checkpass(form)
{
  if(isEmpty(form.conditiondesc.value))
  {
    alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_ConditionDesc",false)) %>");
    return false;
  }
  if(form.conditiondesc.value == -1 || form.conditiondesc.value == "-1")
  {
    alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_ConditionDesc",false)) %>");
    return false;
  }
  if(isEmpty(form.conditioncode.value))
  {
    alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_ConditionCode",false)) %>");
    return false;
  }
  return true;
}

function page_done()
{
  if(!checkpass(conditioneditform))
    return;
	document.conditioneditform.actionname.value = "done";
	document.conditioneditform.submit();
}
</script>
<body>
<%
  HashMap ConditionInfo = (HashMap)pageContext.getAttribute("conditioninfo");
  if(ConditionInfo==null)
  {
    ConditionInfo = new HashMap();
  }
  Vector allconditiontype = (Vector)pageContext.getAttribute("allconditiontype");
  if(allconditiontype == null)
  {
    allconditiontype = new Vector();
  }
  Vector allstatus = (Vector)pageContext.getAttribute("allstatus");
  if(allstatus == null)
  {
    allstatus = new Vector();
  }
  boolean isEdit = true;
  String conditionid = request.getParameter("conditionid");
  if(conditionid==null)
  {
     conditionid ="";
     isEdit = false;
  }
  cat.debug("The ConditionInfo is :" + ConditionInfo);
  cat.debug("The allconditiontype is :" + allconditiontype);
  cat.debug("The allstatus is :" + allstatus);
 %>

<table width="100%" cellspacing="0" border="0" cellpadding="0">
   <form name="conditioneditform" method="post" action="../../Dispatcher" target="_parent">
			   <input type="hidden" name="pagename" value="conditionedit">
			   <input type="hidden" name="actionname">
				 <input type="hidden" name="datelastupdated" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">
         <input type="hidden" name="orgid" value="<%=JspHelper.filterNull( userInfo.get("orgid") )%>">
         <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
         <input type="hidden" name="conditionid" value="<%=JspHelper.filterNull( conditionid )%>">

  <tr>
    <td>
      <table width="100%" cellspacing="0" cellpadding="0" dwcopytype="CopyTableCell">
        <tr>
          <td class="summary_top"></td>
        </tr>
        <tr>
          <td colspan="2"><img src="../../images/<%= strLanguageCode %>/quote.gif" width="16" height="11">
            <%= label.getLabelName("L_NECondition") %><%= label.getLabelName("L_Colon") %></td>
        </tr>
      </table>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">

        <tr>
          <td class="need" width="110"><%= label.getLabelName("L_ConditionCode") %><%= label.getLabelName("L_Colon") %></td>
          <td>
           <%if(isEdit){%>
            <input type="text" name="conditioncode" readonly="true" value='<%=JspHelper.filterNull(ConditionInfo.get("conditioncode"))%>' size="15">
           <%}else{%>
            <input type="text" name="conditioncode"  size="15">
           <%}%>
          </td>
        </tr>

        <tr>
          <td class="need"><%= label.getLabelName("L_Category") %><%= label.getLabelName("L_Colon") %></td>
          <td>
             <%if(!isEdit){%>
              <oval:select optionsName="allconditiontype" optionValueKey="conditiontype" optionInnerTextKey="description" property="conditiontype"/>
            <%}else{%>
              <oval:select optionsName="allconditiontype" optionValueKey="conditiontype" optionInnerTextKey="description" name="conditioninfo" property="conditiontype" disabled="true"/>
            <%}%>
          </td>
        </tr>

        <tr>
          <td class="need"><%= label.getLabelName("L_ConditionDesc") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <input type="text" name="conditiondesc" value="<%=JspHelper.filterNull(ConditionInfo.get("conditiondesc"))%>" size="70">
          </td>
        </tr>

        <tr>
          <td class="need"><%= label.getLabelName("L_Status") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <%if(!isEdit){%>
              <oval:select optionsName="allstatus" optionValueKey="statuscode" optionInnerTextKey="statusname" property="status"/>
            <%}else{%>
              <oval:select optionsName="allstatus" optionValueKey="statuscode" optionInnerTextKey="statusname" name="conditioninfo" property="status"/>
            <%}%>
          </td>
        </tr>

      </table>
    </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr>
    <td class="td_center"><a onclick="page_done()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a></td>
  </tr>
  </form>
</table>
</body>
</html>


